<template>
  <div class="fillcontain">
    <div class="con-title">
      <p>规则组冲突信息</p>
    </div>
    <!-- 查询表单 -->
    <el-form
      :model="searchParams"
      ref="ruleForm"
      label-width="80px"
      class="search_container"
    >
      <el-row>
        <el-col :span="6">
          <el-form-item label="任务编码" prop="demandNo">
            <el-input
              clearable
              disabled
              v-model="searchParams.flowName"
              placeholder="任务编码"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <div class="contain">
      <!-- 查询结果列表 -->
      <div class="table_container">
        <el-table
          ref="multipleTable"
          :data="groupInfoList"
          tooltip-effect="dark"
          highlight-current-row
          header-cell-class-name="table-header-class"
          style="width: 100%"
          @expand-change="expandChange"
        >
          <el-table-column type="expand">
            <template slot-scope="scope">
              <el-row>
                <div class="table-title">
                  <div class="left">
                    <div class="redline"></div>
                    <p style="font-size: 16px">冲突详细版本</p>
                  </div>
                </div>
                <div class="contain">
                  <div class="table-title" style="margin-top: 20px">
                    <div class="left">
                      <div class="redline"></div>
                      <p>版本：未发布版本</p>
                    </div>
                    <div class="right">
                      <el-button
                        type="info" plain
                        size="mini"
                        @click="toruleupdate(scope.row, 'list')"
                        >编辑规则</el-button
                      >
                    </div>
                  </div>
                  <el-table :data="tableDatas" style="margin: 15px">
                    <el-table-column
                      v-for="(col, i) in conditionList"
                      :property="col.decisionCode"
                      :key="col.decisionCode"
                      :index="i"
                      :label="col.conditionDesc"
                    >
                      <template slot="header" slot-scope="scope">
                        <el-tooltip
                          v-if="
                            conditionList[scope.column.index] &&
                            conditionList[scope.column.index].headType == '0'
                          "
                          class="item"
                          effect="dark"
                          :content="scope.column.label"
                          placement="top"
                        >
                          <span> {{ scope.column.label }} </span>
                        </el-tooltip>
                        <el-tooltip
                          v-if="
                            conditionList[scope.column.index] &&
                            conditionList[scope.column.index].headType == '1'
                          "
                          class="item"
                          effect="dark"
                          :content="scope.column.label + '(条件)'"
                          placement="top"
                        >
                          <span> {{ scope.column.label }} (条件) </span>
                        </el-tooltip>
                        <el-tooltip
                          v-if="
                            conditionList[scope.column.index] &&
                            conditionList[scope.column.index].headType == '2'
                          "
                          class="item"
                          effect="dark"
                          :content="scope.column.label + '(动作)'"
                          placement="top"
                        >
                          <span> {{ scope.column.label }} (动作) </span>
                        </el-tooltip>
                      </template>
                      <template slot-scope="scope">
                        <div v-if="scope.row[scope.column.property]">
                          {{ scope.row[scope.column.property].conditionDesc }}
                        </div>
                      </template>
                    </el-table-column>
                    <el-table-column
                      header-align="center"
                      align="center"
                      width="150"
                      label="操作"
                    >
                      <template slot-scope="scope">
                        <span
                          style="color: #409eff; cursor: pointer"
                          @click="toruleupdate(scope.row, 'single')"
                          >编辑规则</span
                        >
                      </template>
                    </el-table-column>
                  </el-table>
                  <div class="table-title" style="margin-top: 20px">
                    <div class="left">
                      <div class="redline"></div>
                      <p>版本：生产版本</p>
                    </div>
                    <div class="right">
                      <el-button
                        type="info" plain
                        size="mini"
                        @click="copyClick(scope.row, 'list', 'p')"
                        >复制规则</el-button
                      >
                    </div>
                  </div>
                  <el-table
                    :data="tableDatas2"
                    style="width: 100%; margin: 15px"
                  >
                    <el-table-column
                      v-for="(col, i) in prodconditionList"
                      :property="col.decisionCode"
                      :key="col.decisionCode"
                      :index="i"
                      :label="col.conditionDesc"
                    >
                      <template slot="header" slot-scope="scope">
                        <el-tooltip
                          v-if="
                            prodconditionList[scope.column.index] &&
                            prodconditionList[scope.column.index].headType ==
                              '0'
                          "
                          class="item"
                          effect="dark"
                          :content="scope.column.label"
                          placement="top"
                        >
                          <span> {{ scope.column.label }} </span>
                        </el-tooltip>
                        <el-tooltip
                          v-if="
                            prodconditionList[scope.column.index] &&
                            prodconditionList[scope.column.index].headType ==
                              '1'
                          "
                          class="item"
                          effect="dark"
                          :content="scope.column.label + '(条件)'"
                          placement="top"
                        >
                          <span> {{ scope.column.label }} (条件) </span>
                        </el-tooltip>
                        <el-tooltip
                          v-if="
                            prodconditionList[scope.column.index] &&
                            prodconditionList[scope.column.index].headType ==
                              '2'
                          "
                          class="item"
                          effect="dark"
                          :content="scope.column.label + '(动作)'"
                          placement="top"
                        >
                          <span> {{ scope.column.label }} (动作) </span>
                        </el-tooltip>
                      </template>
                      <template slot-scope="scope">
                        <div v-if="scope.row[scope.column.property]">
                          {{ scope.row[scope.column.property].conditionDesc }}
                        </div>
                      </template>
                    </el-table-column>
                    <el-table-column
                      header-align="center"
                      align="center"
                      width="150"
                      label="操作"
                    >
                      <template slot-scope="scope">
                        <span
                          style="color: #409eff; cursor: pointer"
                          @click="copyClick(scope.row, 'single', 'p')"
                          >复制</span
                        >
                      </template>
                    </el-table-column>
                  </el-table>
                  <!--   -->
                  <div v-for="(tab, key) in tableDatas3" :key="key">
                    <div class="table-title">
                      <div class="left">
                        <div class="redline"></div>
                        <p>版本：{{ key }}</p>
                      </div>
                      <div class="right">
                        <el-button
                          type="info" plain
                          size="mini"
                          @click="
                            bbcopyClick(scope.row, 'list', tableDatas3[key])
                          "
                          >复制规则</el-button
                        >
                      </div>
                    </div>
                    <el-table
                      :data="tableDatas3[key]"
                      style="width: 100%; margin: 15px"
                    >
                      <!-- <el-table-column
                        v-for="(col, key2) in editionList[key]"
                        :property="col.decisionCode"
                        :key="key2"
                        :label="col.conditionDesc"
                      >
                        <template slot-scope="scope"  v-if="scope.row[scope.column.property] && scope.row[scope.column.property].conditionDesc">
                          {{ scope.row[scope.column.property].conditionDesc }}
                        </template>
                      </el-table-column> -->
                      <el-table-column
                        v-for="(col, key2) in editionList[key]"
                        :property="col.decisionCode"
                        :key="key2"
                        :index="key2"
                        :label="col.conditionDesc"
                      >
                        <template slot="header" slot-scope="scope">
                          <el-tooltip
                            v-if="
                              editionList[key][scope.column.index] &&
                              editionList[key][scope.column.index].headType ==
                                '0'
                            "
                            class="item"
                            effect="dark"
                            :content="scope.column.label"
                            placement="top"
                          >
                            <span> {{ scope.column.label }} </span>
                          </el-tooltip>
                          <el-tooltip
                            v-if="
                              editionList[key][scope.column.index] &&
                              editionList[key][scope.column.index].headType ==
                                '1'
                            "
                            class="item"
                            effect="dark"
                            :content="scope.column.label + '(条件)'"
                            placement="top"
                          >
                            <span> {{ scope.column.label }} (条件) </span>
                          </el-tooltip>
                          <el-tooltip
                            v-if="
                              editionList[key][scope.column.index] &&
                              editionList[key][scope.column.index].headType ==
                                '2'
                            "
                            class="item"
                            effect="dark"
                            :content="scope.column.label + '(动作)'"
                            placement="top"
                          >
                            <span> {{ scope.column.label }} (动作) </span>
                          </el-tooltip>
                        </template>
                        <template
                          slot-scope="scope"
                          v-if="
                            scope.row[scope.column.property] &&
                            scope.row[scope.column.property].conditionDesc
                          "
                        >
                          {{ scope.row[scope.column.property].conditionDesc }}
                        </template>
                      </el-table-column>
                      <el-table-column
                        header-align="center"
                        align="center"
                        width="150"
                        label="操作"
                      >
                        <template slot-scope="scope">
                          <span
                            style="color: #409eff; cursor: pointer"
                            @click="bbcopyClick(scope.row, 'single')"
                            >复制</span
                          >
                        </template>
                      </el-table-column>
                    </el-table>
                  </div>
                  <div class="content-footer">
                    <el-button @click="toList(scope.row)">取消</el-button>
                    <el-button type="info" plain @click="conflictSubmit(scope.row)"
                      >已解决冲突</el-button
                    >
                  </div>
                </div>
              </el-row>
            </template>
          </el-table-column>
          <el-table-column
            property="groupIdentify"
            label="规则组标识"
            align="center"
            show-overflow-tooltip
            min-width="120"
          >
            <template align="center" slot-scope="scope1">
              <span :class="{ red: scope1.row.clashStatus == '1' }">{{
                scope1.row.groupIdentify
              }}</span>
            </template>
          </el-table-column>
          <el-table-column
            property="groupName"
            label="规则组名称"
            align="center"
            show-overflow-tooltip
            min-width="80"
          >
            <template align="center" slot-scope="scope1">
              <span :class="{ red: scope1.row.clashStatus == '1' }">{{
                scope1.row.groupName
              }}</span>
            </template></el-table-column
          >
          <el-table-column
            property="groupDesc"
            label="规则组描述"
            align="center"
            show-overflow-tooltip
            min-width="80"
          >
            <template align="center" slot-scope="scope1">
              <span :class="{ red: scope1.row.clashStatus == '1' }">{{
                scope1.row.groupDesc
              }}</span>
            </template></el-table-column
          >
          <el-table-column
            label="操作"
            align="center"
            show-overflow-tooltip
            min-width="100"
          >
            <template slot-scope="scope">
              <el-button
                type="primary"
                plain
                :disabled="scope.row.disabled"
                @click="toogleExpandRule(scope.row)"
                >解决冲突</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!-- 分页 -->
      <!-- <el-pagination
        class="pagination"
        @size-change="sizeChangeHandle"
        @current-change="currentChangeHandle"
        :current-page="paginations.pageIndex"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="paginations.pageSize"
        :total="paginations.totalPage"
        layout="total, sizes, prev, pager, next, jumper"
      >
      </el-pagination> -->
    </div>
    <el-dialog :title="`解决冲突`" :visible.sync="addvise" width="70%" center>
      <!-- 列表 -->
      <desion-or-update
        :isconflict="isconflict"
        :dataForm="dataForm"
        :checkEntity="checkEntitys"
        :versionType="versionType"
        :conditionDivisorList="conditionDivisorList"
        :actionDivisorList="actionDivisorList"
        ref="desionOrUpdate"
      >
      </desion-or-update>
      <div class="content-footer">
        <el-button type="info" plain @click="dataFormSubmit()">确定</el-button>
        <el-button @click="toList2()">取消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { confirmClash } from "@/api/version/version";
import {
  getClashInfo,
  changeClashInfo,
  copyRuleGroup,
  clashUpate,
} from "@/api/task";
import { getDecisionsByGroup } from "@/api/ruleConfig/decision";
import { saveRuleGroup } from "@/api/ruleConfig/groupInfo";
import constant from "@/api/constant";
import desionOrUpdate from "../ruleConfig/decision/add-or-update";
export default {
  data() {
    return {
      dataForm: {
        groupIdentify: "",
        taskNo: "",
        decisionList: [],
        decisionSingle: [],
        switch: "",
      },
      editForm: {}, //编辑规则
      copyForm: {
        groupIdentify: "",
        taskNo: "",
        decisionList: [],
        decisionSingle: [],
        type: "",
        switch: "",
        values: [],
      },
      isconflict: true, //流程决策表弹窗
      checkEntitys: [],
      versionType: "",
      addvise: false,
      taskDetail: {},
      conditionDivisorList: [],
      actionDivisorList: [],
      tabDialog: 1,
      tableData: [],
      searchParams: {
        flowName: "",
      },
      status: constant.status,
      flag: constant.flag,
      taskLevel: constant.taskLevel,
      addFlag: true,
      paginations: {
        total: 0, // 总数
        pageIndex: 1, // 当前位于哪页
        pageSize: 20, // 1页显示多少条
        pageSizes: [5, 10, 15, 20], //每页显示多少条
        layout: "total, sizes, prev, pager, next, jumper", // 翻页属性
      },
      taskInfo: {},
      tableDatas: [],
      tableDatas2: [],
      tableDatas3: {
        null: [
          // {
          //   RCODE: {
          //     id: 1306,
          //     conditionDesc: "",
          //     headType: "0",
          //     conditionExpression: "规则编码",
          //     decisionCode: "RCODE",
          //   },
          //   RNAME: {
          //     id: 1307,
          //     groupIdentify: "",
          //     decisionCode: "RNAME",
          //     conditionDesc: "",
          //     headType: "0",
          //   },
          // },
        ],
      },
      groupInfoList: [],
      conditionList: [
        {
          id: 1306,
          headType: "0",
          conditionDesc: "规则编码",
          conditionExpression: "规则编码",
          // decisionCode: "RCODE"
        },
        {
          id: 1307,
          groupIdentify: "",
          conditionDesc: "规则名称",
          decisionCode: "RNAME",
          headType: "0",
          conditionExpression: "规则名称",
        },
      ], //生产表头信息
      prodconditionList: [
        {
          id: 1306,
          headType: "0",
          conditionDesc: "规则编码",
          conditionExpression: "规则编码",
          // decisionCode: "RCODE"
        },
        {
          id: 1307,
          groupIdentify: "",
          conditionDesc: "规则名称",
          decisionCode: "RNAME",
          headType: "0",
          conditionExpression: "规则名称",
        },
      ],
      // 版本头
      editionList: {
        null: [
          {
            id: 1306,
            conditionDesc: "规则编码",
            headType: "0",
            conditionExpression: "规则编码",
            decisionCode: "RCODE",
          },
          {
            id: 1307,
            groupIdentify: "",
            decisionCode: "RNAME",
            conditionDesc: "规则名称",
            headType: "0",
            conditionExpression: "规则名称",
          },
        ],
      },
    };
  },
  created() {},
  activated() {},
  components: {
    desionOrUpdate,
  },
  mounted() {
    this.searchParams.flowName = this.$route.params.id;
    this.dataForm.taskNo = this.$route.params.id;
    this.initTask();
  },
  methods: {
    expandChange(row, expandedRows) {
      // 该处是用于判断是展开还是收起行，只有展开的时候做请求，避免多次请求！
      // if (row.disabled) {
      //   let $table = this.$refs.multipleTable;
      //     $table.toggleRowExpansion(row,false);
      // }
      // console.log(row, expandedRows, "222");
      // 展开的时候expandedRows有值，收起的时候为空.
      this.editForm = row;
      if (expandedRows.length > 0) {
        this.initgetClashInfo(row.groupIdentify);
      }
    },
    toList2() {
      this.addvise = false;
    },
    // 决策表单提交
    dataFormSubmit() {
      // console.log(this.$refs["desionOrUpdate"]);
      let values = [];
      let tableDatas = this.$refs.desionOrUpdate.tableDatas;
      let conditionList = this.$refs.desionOrUpdate.conditionList;
      // debugger
      if (tableDatas.length > 0) {
        for (var i = 0; i < tableDatas.length; i++) {
          let data = tableDatas[i];
          if (data) {
            conditionList.forEach((item) => {
              // console.log(data, conditionList);
              if (data[item.decisionCode]) {
                data[item.decisionCode]["rowIndex"] = i;
                values.push(data[item.decisionCode]);
              }
            });
          }
        }
      }
      let params = {
        groupInfo: JSON.stringify(this.editForm),
        relList: JSON.stringify([]),
        heads: JSON.stringify(this.$refs.desionOrUpdate.conditionList),
        values: JSON.stringify(values),
        delList: JSON.stringify(this.$refs.desionOrUpdate.delList),
        delHeadList: JSON.stringify(this.$refs.desionOrUpdate.delHeadList),
        taskInfo: JSON.stringify({ taskNo: this.dataForm.taskNo }),
        versionType: "d",
      };
      let that = this;
      this.$store.dispatch("loading/CHANGE_LOADING", true);
      saveRuleGroup(params)
        .then((res) => {
          this.$store.dispatch("loading/CHANGE_LOADING", false);
          if (res.data && res.data.resultCode === 0) {
            this.$message({
              message: "操作成功",
              type: "success",
              duration: 1500,
              onClose: () => {
                this.visible = false;
                // this.dataForm = {
                //   id: null,
                //   groupName: "",
                //   groupDesc: "",
                //   remark: "",
                //   isEffect: "1",
                // };
                // this.entitysProperties = [];
                // this.checkEntity = [];
                this.initgetClashInfo(this.dataForm.groupIdentify);
                this.toList2();
              },
            });
          } else {
            this.$message.error(res.data.resultMsg);
          }
        })
        .catch((err) => {
          this.$store.dispatch("loading/CHANGE_LOADING", false);
        });
    },
    toogleExpandRule(row) {
      // console.log(row);
      let $table = this.$refs.multipleTable;
      this.dataForm.groupIdentify = row.groupIdentify;
      // this.groupInfoList.map((item) => {
      //   if (row.id != item.id) {
      //     $table.toggleRowExpansion(item, false);
      //   }
      // });
      this.editForm = row;
      $table.toggleRowExpansion(row);
      // console.log(row);
    },
    // list 全部 /single 单个
    toruleupdate(value, str) {
      // console.log(value, str, "%%");
      this.dataForm.switch = str;
      this.addvise = true;
      if (str == "list") {
        this.dataForm.groupIdentify = value.groupIdentify;
        this.dataForm.taskNo = value.taskNo;
        // console.log(this.$refs);
        this.$nextTick(() => {
          this.$refs.desionOrUpdate.getChangeClashInfo(
            this.dataForm,
            this.dataForm.decisionList
          );
        });
      } else if (str == "single") {
        this.dataForm.decisionSingle = [];
        this.dataForm.decisionSingle.push(value["RCODE"].conditionDesc);
        this.dataForm.groupIdentify = value.RCODE.groupIdentify;
        this.$nextTick(() => {
          // console.log(this.dataForm);
          this.$refs.desionOrUpdate.getChangeClashInfo(
            this.dataForm,
            this.dataForm.decisionSingle
          );
        });
      }
    },
    // str:list 全部 /single 单个 生产
    copyClick(value, str, type) {
      // console.log(value, str, type, "%%");
      this.copyForm.switch = str;
      this.copyForm.type = type;
      this.copyForm.taskNo = this.$route.params.id;
      if (str == "list") {
        this.copyForm.groupIdentify = value.groupIdentify;
        if (this.prodconditionList && this.prodconditionList[0]) {
          this.copyForm.rowTaskNo = this.prodconditionList[0].taskNo;
        }
        // console.log(this.copyForm.taskNo, "222");
        this.getcopyData(this.copyForm, this.copyForm.decisionList);
      } else if (str == "single") {
        this.copyForm.groupIdentify = value["RCODE"].groupIdentify;
        this.copyForm.rowTaskNo = value["RCODE"].taskNo;
        let rule = [];
        for (const key in value) {
          rule.push(value[key]);
          this.copyForm.decisionSingle[0] = {};
          this.copyForm.decisionSingle[0] = {
            decision: value["RCODE"].conditionDesc,
            rule: rule,
          };
        }
        this.getcopyData(this.copyForm, this.copyForm.decisionSingle);
      }
    },
    // dev复制
    bbcopyClick(value, str, data) {
      // console.log(value, str, data);
      value.type = "d";
      value.taskNo = this.$route.params.id;
      let decisionList = [];
      if (str == "list") {
        value.rowTaskNo = data[0].RCODE.taskNo;
        data.forEach((e, i) => {
          if (e["RCODE"] && e["RCODE"].conditionDesc) {
            let rule = [];
            for (const key in e) {
              // console.log(key);
              rule.push(e[key]);
              decisionList[i] = {};
              decisionList[i] = {
                decision: e["RCODE"].conditionDesc,
                rule: rule,
              };
            }
          }
        });
      } else if (str == "single") {
        let rule = [];
        value.groupIdentify = value["RCODE"].groupIdentify;
        value.rowTaskNo = value["RCODE"].taskNo;
        for (const key in value) {
          rule.push(value[key]);
          decisionList[0] = {};
          decisionList[0] = {
            decision: value["RCODE"].conditionDesc,
            rule: rule,
          };
        }
      }
      this.getcopyData(value, decisionList);
    },
    // 已解决冲突
    clashUpateData(row) {
      let param = {
        taskNo: row.taskNo,
        groupIdentify: row.groupIdentify,
      };
      clashUpate(param).then((res) => {
        if (res.data.resultCode == 0) {
          let $table = this.$refs.multipleTable;
          $table.toggleRowExpansion(row);
          this.initTask();
        } else {
          this.$message.error(res.data.resultMsg);
        }
      });
    },
    //初始化冲突表信息
    initgetClashInfo(groupIdentify) {
      let params = {
        groupIdentify: groupIdentify,
        taskNo: this.$route.params.id,
      };
      // this.tableInit()
      let that = this;
      getClashInfo(params)
        .then((res) => {
          this.$store.dispatch("loading/CHANGE_LOADING", false);
          if (res.data.data) {
            //
            let data = res.data.data;
            this.tableDatas = data.ruleBody;
            if (data.ruleHead && data.ruleHead.length) {
              this.conditionList = data.ruleHead;
            } else {
              this.conditionList = [
                {
                  id: 1306,
                  conditionDesc: "规则编码",
                  headType: "0",
                  decisionCode: "RCODE",
                  conditionExpression: "规则编码",
                },
                {
                  id: 1307,
                  conditionDesc: "规则名称",
                  headType: "0",
                  decisionCode: "RNAME",
                  conditionExpression: "规则名称",
                },
              ];
            }

            this.dataForm.decisionList = [];
            this.tableDatas.forEach((e, i) => {
              if (e["RCODE"] && e["RCODE"].conditionDesc) {
                this.dataForm.decisionList.push(e["RCODE"].conditionDesc);
              }
            });
            // console.log(this.dataForm.decisionList, "decisionList");
            this.tableDatas2 = data.prdRuleBody;
            //生产表头信息
            if (data.prdRuleHead && data.prdRuleHead.length) {
              this.prodconditionList = data.prdRuleHead;
            } else {
              this.prodconditionList = [
                {
                  id: 1306,
                  conditionDesc: "规则编码",
                  headType: "0",
                  decisionCode: "RCODE",
                  conditionExpression: "规则编码",
                },
                {
                  id: 1307,
                  conditionDesc: "规则名称",
                  headType: "0",
                  decisionCode: "RNAME",
                  conditionExpression: "规则名称",
                },
              ];
            }
            this.tableDatas2.forEach((e, i) => {
              if (e["RCODE"] && e["RCODE"].conditionDesc) {
                let rule = [];
                for (const key in e) {
                  // console.log(key);
                  rule.push(e[key]);
                  this.copyForm.decisionList[i] = {};
                  this.copyForm.decisionList[i] = {
                    decision: e["RCODE"].conditionDesc,
                    rule: rule,
                  };
                }
              }
            });
            // console.log(this.copyForm.decisionList);
            this.editionList = {};
            if (data.devRuleHead) {
              this.editionList = data.devRuleHead;
            } else {
              // 版本头
              this.editionList = {
                null: [
                  {
                    id: 1306,
                    conditionDesc: "规则编码",
                    headType: "0",
                    conditionExpression: "规则编码",
                    decisionCode: "RCODE",
                  },
                  {
                    id: 1307,
                    groupIdentify: "",
                    decisionCode: "RNAME",
                    headType: "0",
                    conditionDesc: "规则名称",
                    headType: "0",
                    conditionExpression: "规则名称",
                  },
                ],
              };
            }
            if (data.devRuleBody) {
              this.tableDatas3 = data.devRuleBody;
            } else {
              this.tableDatas3 = {
                null: [
                  // {
                  //   RCODE: {
                  //     id: 1306,
                  //     conditionDesc: "",
                  //     headType: "0",
                  //     conditionExpression: "规则编码",
                  //     decisionCode: "RCODE",
                  //   },
                  //   RNAME: {
                  //     id: 1307,
                  //     groupIdentify: "",
                  //     headType: "0",
                  //     decisionCode: "RNAME",
                  //     conditionDesc: "",
                  //     headType: "0",
                  //   },
                  // },
                ],
              };
            }
          } else {
            this.$message.error(res.data.resultMsg)
          }
        })
        .catch((err) => {
          this.$store.dispatch("loading/CHANGE_LOADING", false);
        });
    },
    // 复制数据
    getcopyData(copyForm, values) {
      let param = {
        versionType: copyForm.type,
        taskNo: copyForm.taskNo,
        groupIdentify: copyForm.groupIdentify,
        values: values,
        rowTaskNo: copyForm.rowTaskNo,
      };
      copyRuleGroup(param).then((res) => {
        if (res.data.resultCode == 0) {
          this.$message.success(res.data.resultMsg);
          this.initgetClashInfo(this.dataForm.groupIdentify);
        } else {
          this.$message.error(res.data.resultMsg);
        }
      });
    },
    // 已解决冲突
    conflictSubmit(row) {
      this.clashUpateData(row);
    },
    toList(row) {
      constant.clearTag(this);
      let $table = this.$refs.multipleTable;
      $table.toggleRowExpansion(row);
    },
    // 初始化
    initTask() {
      let params = {
        taskNo: this.$route.params.id,
      };
      this.groupInfoList = [];
      this.$store.dispatch("loading/CHANGE_LOADING", true);
      confirmClash(params)
        .then((res) => {
          this.$store.dispatch("loading/CHANGE_LOADING", false);
          // console.log(res, "res");
          if (res.data.data) {
            this.groupInfoList = res.data.data;
          }
        })
        .catch((err) => {
          this.$store.dispatch("loading/CHANGE_LOADING", false);
        });
    },
    // 清除查询条件
    resetSearch() {
      this.searchParams.flowName = "";
      this.searchParams.publishBegDate = "";
      this.searchParams.publishEndDate = "";
      this.searchParams.auditStatus = "";
      this.searchParams.publishUser = "";
      this.searchParams.taskNo = "";
    },
    // 每页多少条切换
    handleSizeChange(pageSize) {
      this.paginations.pageSize = pageSize;
    },
    // 上下分页
    handleCurrentChange(page) {
      this.paginations.pageIndex = page;
    },
    dateFormat1(row, column) {
      return constant.dateFormat("YYYY-mm-dd HH:MM:SS", row.taskStartTime);
    },
    dateFormat2(row, column) {
      return constant.dateFormat("YYYY-mm-dd HH:MM:SS", row.taskEndTime);
    },
    // 每页数
    sizeChangeHandle(val) {
      this.paginations.pageSize = val;
      this.paginations.pageIndex = 1;
    },
    // 当前页
    currentChangeHandle(val) {
      this.paginations.pageIndex = val;
    },
  },
  watch: {},
  computed: {},
  filters: {
    statusFormat: function (value) {
      return constant.getLabel(value, constant.status);
    },
    taskLevelFormat: function (value) {
      return constant.getLabel(value, constant.taskLevel);
    },
    flagFormat: function (value) {
      return constant.getLabel(value, constant.flag);
    },
    isEffectFormat: function (value) {
      return constant.getLabel(value, constant.ruleConfig.isEffects);
    },
    clashDivisorFormat: function (value) {
      return constant.getLabel(value, constant.clashDivisor);
    },
  },
};
</script>

<style lang="less" scoped>
.con-title {
  padding-left: 30px;
  height: 50px;
  line-height: 40px;
  border-bottom: 1px solid #ebeef5;
  p {
    font-size: 16px;
  }
}
.fillcontain {
  padding-bottom: 0;

  .fastQuery {
    padding: 15px 20px 10px 20px;
    background: #fff;
    border-bottom: 1px solid #e1e1e1;

    .fastQuery_title {
      color: #666;
      padding: 6px 0px;
    }

    .fastQuery_item {
      margin: 0 10px;
    }

    .item_default {
      .el-button {
        color: #409eff !important;
        border-color: #c6e2ff !important;
        background-color: #ecf5ff !important;
      }
    }

    .moreCondition {
      color: #68a3fc;
      cursor: pointer;
      padding: 6px 0px;

      .el-icon-d-arrow-right {
        transform: rotate(90deg);
      }

      .el-icon-d-arrow-left {
        transform: rotate(-90deg);
      }
    }
  }
}

.contain {
  background: #fff;
  padding: 10px;
  margin-bottom: 20px;
}

.pagination {
  padding: 10px 20px;
  text-align: right;
}

.operationIcon {
  // padding: 12px;
  border: 1px solid #e5e5e5;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-block;
  cursor: pointer;
  box-shadow: 0 0 3px #f9f9f9;

  .svg-icon {
    font-size: 14px;
    fill: #68a3fc;
  }
}

.search_container {
  padding: 20px 20px 0 20px;
}

.el-dropdown {
  vertical-align: top;
}

.el-dropdown + .el-dropdown {
  margin-left: 15px;
}

.el-icon-arrow-down {
  font-size: 12px;
}
.table-title {
  background-color: #f9f9f9;
  height: 40px;
  padding: 0px 20px;
  line-height: 40px;
  .left {
    display: flex;
    .redline {
      margin-top: 13px;
      margin-right: 10px;
      width: 2px;
      height: 14px;
      background-color: #5d9cec;
    }
    p {
      font-weight: 700;
    }
  }
}
</style>



